package com.pretty.test.controller.system.menu;


import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pretty.test.controller.system.menu.dto.MenuListDTO;
import com.pretty.test.controller.system.menu.vo.MenuListVO;
import com.pretty.test.entity.PetsMenu;
import com.pretty.test.service.IPetsMenuService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统菜单控制器
 * @author dujianyu
 * @since 2021-04-09
 */
@RestController
@AllArgsConstructor
@RequestMapping("/menu")
public class PetsMenuController {

    private IPetsMenuService service;

    /**
     * 自定义列表
     * @param dto
     */
    @GetMapping("/list")
    public R<List<MenuListVO>> list(MenuListDTO dto){
        return R.ok(service.selectMenuList(dto));
    }

    /**
     * 新增或修改
     * @param petsMenu
     */
    @PostMapping("/submit")
    public  R<Boolean> submit(@RequestBody PetsMenu petsMenu){
        return R.ok(service.saveOrUpdate(petsMenu));
    }

    /**
     * 逻辑删除
     * @param id
     */
    @PostMapping("/delete")
    public R<Boolean> delete(String id){
        return R.ok(service.removeById(id));
    }


}
